package fr.uniscol.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import fr.uniscol.model.BaseAnneeScolaire;
import fr.uniscol.model.Eleve;

public class EleveRowMapper implements RowMapper<Eleve> {

	private BaseAnneeScolaire base = null;
	
        public EleveRowMapper(){
        }
        
	public EleveRowMapper(BaseAnneeScolaire base){
		this.base = base;
	}
	
	public BaseAnneeScolaire getBase() {
		return base;
	}

	public void setBase(BaseAnneeScolaire base) {
		this.base = base;
	}

	@Override
	public Eleve mapRow(ResultSet rs, int rownum) throws SQLException {
		
		Eleve eleve = new Eleve();
		eleve.setId(rs.getInt("ELEVEID"));
		eleve.setIdSiecle(rs.getString("ID_SIECLE"));
		eleve.setNom(rs.getString("NOM"));
		eleve.setPrenom(rs.getString("PRENOM"));
		eleve.setIne(rs.getString("INE"));
		
		eleve.setBase(getBase());
		
		return eleve;
	}

}
